import request from '@/utils/request'

export function articleList(pageNum, pageSize) {
    return request({
        url: '/article/articleList',
        method: 'get',
        params: {
            pageNum,
            pageSize
        }
    })
}


export function like(articleId) {
    return request({
        url: '/article/like',
        method: 'post',
        data: { articleId }
    })
}

export function favorite(articleId) {
    return request({
        url: '/article/favorite',
        method: 'post',
        data: { articleId }
    })
}

export function banner() {
    return request({
        url: '/article/banner',
        method: 'get'
    })
}

// 新增获取文章详情的方法
export function getArticleById(id) {
    return request({
        url: `/article/articleById`,
        method: 'get',
        params: { id }
    })
}

// 添加评论
export const addComment = (data) => {
  return request({
    url: '/article/comment/add',
    method: 'post',
    data
  })
}

export function commentLike(id) {
    return request({
        url: `/article/comment/like`,
        method: 'get',
        params: { id }
    })
}

export function visitor() {
    return request({
        url: `/article/visitor`,
        method: 'get'
    })
}

// 发布文章
export function addArticle(data) {
    return request({
        url: '/article/add',
        method: 'post',
        data
    })
}

export function likeOrFavoriteInfo(pageNum, pageSize,type) {
    return request({
        url: `/article/likeFavoriteInfo`,
        method: 'get',
        params: { pageNum, pageSize,type }
    })
}

export function listArticleAll(pageNum, pageSize,id) {
    return request({
        url: `/article/articleAll`,
        method: 'get',
        params: { pageNum, pageSize,id }
    })
}

export function friendCircle() {
    return request({
        url: `/article/friend`,
        method: 'get',
    })
}

//获取所有游记
export function articleStrategy(pageNum, pageSize) {
    return request({
        url: `/article/articleStrategy`,
        method: 'get',
        params: { pageNum, pageSize }
    })
}

//获取所有攻略
export function articleNotes(pageNum, pageSize) {
    return request({
        url: `/article/articleNotes`,
        method: 'get',
        params: { pageNum, pageSize }
    })
}